package cn.ztr.familyalbum.common;

/**
 *  @author: baoaijun
 *  @Date: 2020/5/15 9:53
 *  @Description: 状态码定义类
 */
public enum ResultCode {
    SUCCESS(200, "成功"),//成功状态码
    UNAUTHORIZED(401, "没有权限"),
    FORBIDDEN(403, "拒绝访问"),
    /* 参数错误：1001-1999 */
    PARAM_IS_INVALID(1001, "参数无效"),
    PARAM_IS_BLACK(1002, "参数为空"),
    PARAM_TYPE_BIND_ERROR(1003, "参数类型错误"),
    PARAM_NOT_COMPLETE(1004, "参数缺失"),
    PARAM_CHECK_ERROR(1005, "参数错误"),
    METHOD_NOT_ALLOWED(405, "不支持当前请求方法"),
    UNSUPPORTED_MEDIA_TYPE(415, "不支持当前媒体类型"),


    /* 用户错误：2001-2999 */
    USER_NOT_LOGGED_IN(2001, "用户未登录"),
    USER_LOGGED_ERROR(2002, "账号不存在或密码错误"),
    USER_ACCOUNT_FORBIDDEN(2003, "账号已被禁用"),
    USER_NOT_EXIST(2004, "用户不存在"),
    USER_HAS_EXISTED(2005, "用户已存在"),
    /* 500错误 */
    INTERNAL_SERVER_ERROR(500, "服务器内部错误"),
    INTERNAL_SERVER_ERROR_DB(500, "数据库错误"),
    INTERNAL_SERVER_ERROR_DB_UNFIND(500,"数据库未找到");
    private Integer code;

    private String message;

    ResultCode(Integer code, String message){
        this.code = code;
        this.message = message;
    }

    public Integer code(){
        return this.code;
    }

    public String message(){
        return this.message;
    }
}
